
#ifdef CONVOLVE_HORIZONTAL
const ivec2 offsets[7] = ivec2[7](ivec2(-3, 0), ivec2(-2, 0), ivec2(-1, 0), ivec2(0, 0), ivec2(1, 0), ivec2(2, 0), ivec2(3, 0));
#elif defined(CONVOLVE_VERTICAL)
const ivec2 offsets[7] = ivec2[7](ivec2(0, -3), ivec2(0, -2), ivec2(0, -1), ivec2(0, 0), ivec2(0, 1), ivec2(0, 2), ivec2(0, 3));
#endif
const float weights[7] = float[](0.001, 0.028, 0.233, 0.474, 0.233, 0.028, 0.001);
//const float weights[7] = float[](0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5);

void main()
{
  vec2 uvs = vTexCoord.xy / cb_PostEffect_SSR_Convolution.u_UVScale;
  vec4 color = vec4(0.0);
  
  for (uint i = 0; i < 7; i++)
  {
  #ifdef SSR_MAPS_ARRAY_ID
    color += vTextureLod(MapWithMips, vec3(uvs + (offsets[i] + vec2(0.5, 0.5))*cb_PostEffect_SSR_Convolution.u_PixelSize, float(SSR_MAPS_ARRAY_ID)), cb_PostEffect_SSR_Convolution.u_MipLevel) * weights[i];
  #else
    color += vTextureLod(MapWithMips, uvs + (offsets[i] + vec2(0.5, 0.5))*cb_PostEffect_SSR_Convolution.u_PixelSize, cb_PostEffect_SSR_Convolution.u_MipLevel) * weights[i];
  #endif
  }

	FRAGCOLOR = color;
}

/*const vec4 colors[6] = vec4[](vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0));
#ifdef CONVOLVE_HORIZONTAL
void main()
{
  FRAGCOLOR = vTextureLod(EyeMapWithMips, vec2(0.5,0.5), cb_PostEffect_SSR_Convolution.u_MipLevel);
}
#elif defined(CONVOLVE_VERTICAL)
void main()
{
  uint colorInd = int(cb_PostEffect_SSR_Convolution.u_MipLevel)%6;
  FRAGCOLOR = colors[colorInd];
}
#endif*/
